package com.school.entity;

//父类：提取Student与Teacher的共性属性和共性方法
public abstract class Person {
    //protected权限：子类可访问，外部包不可直接访问
    protected String id;
    protected String name;
    protected String gender;

    //父类构造方法：初始化共性属性
    public Person(String id, String name, String gender) {
        this.id = id;
        this.name = name;
        this.gender = gender;
    }

    //父类共性方法：打印基础信息
    protected void printBaseInfo() {
        System.out.println("ID：" + this.id + " | 姓名：" + this.name + " | 性别：" + this.gender);
    }

    //父类业务方法：打印工作单
    public abstract void printWorksheet();

    // Getter方法：外部包（system包）访问protected属性的唯一途径（权限控制验证，）
    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }
}